#!/usr/env/bin python
# -*- coding: utf-8 -*-

# @Time    : 2020-11-23 9:42 上午
# @Author  : yangdy
# @File    : 2020-11-23.452.用最少数量的箭引爆气球
# @Software: PyCharmCE
from tools.my_methods import *


class Solution:
    def findMinArrowShots(self, points: List[List[int]]) -> int:
        if not points:
            return 0
        points.sort(key=lambda x: x[1])
        pre, ans = points[0][1], 1
        for i in range(1, len(points)):
            if points[i][0] > pre:
                ans += 1
                pre = points[i][1]
        return ans

